package cn.bugio.task01;

import cn.bugio.task01.dao.UserDao;
import cn.bugio.task01.service.IDriver;
import cn.bugio.task01.service.UserService;
import cn.bugio.task01.service.impl.BMW;
import cn.bugio.task01.service.impl.Benz;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Hello world!
 *
 */
public class App
{
    public static void main( String[] args ) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext02.xml");
        UserDao userDao = (UserDao) applicationContext.getBean("userDao");
        userDao.say();
        UserService userService = (UserService) applicationContext.getBean("userService");
        userService.say();

        IDriver driver = (IDriver) applicationContext.getBean("driver");
        driver.driver();

        BMW bmw = (BMW) applicationContext.getBean("bmw");
        Benz benz = (Benz) applicationContext.getBean("benz");
        driver.driver(benz);
        System.out.println("------------------");
        driver.setCar(benz);
        driver.driver();
    }
}
